#!/sbin/openrc-run

depend() {
	need net
	provide jabber-server
}

start() {
	[ -d /var/run/jabber ] || mkdir /var/run/jabber
	#source /etc/env.d/java/20sun-jdk-1.5.0.06
	#OPENFIRE_CMD="${JAVA_HOME}/bin/java"
	OPENFIRE_CMD=`GENTOO_VM=${GENTOO_VM} java-config -J`

	ebegin "Starting Openfire Server"
	start-stop-daemon \
		--user jabber \
		--background \
		--make-pidfile \
		--pidfile /var/run/jabber/openfire.pid \
		--start \
		--exec ${OPENFIRE_CMD} -- ${OPENFIRE_ARGS} > /var/log/openfire.log 2>&1
	eend
}

stop() {
	ebegin "Stopping Openfire Messenger"
	start-stop-daemon --pidfile /var/run/jabber/openfire.pid --stop
	eend
}
